package com.kgc.sportscircle.utils;

import com.kgc.sportscircle.pojo.Sportsuser;
import com.kgc.sportscircle.redis.LoginPrefix;
import com.kgc.sportscircle.redis.RedisService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class GetCookie {

    public static String getSportsUserofCookie(HttpServletRequest request){

        //获取本地cookie
        Cookie[] cookies = request.getCookies();
        String token = null;
        for (Cookie cookie:cookies) {
            if (cookie.getName().equals("token")){
                token=cookie.getValue();
            }
        }
        return token;

    }
}
